/**
 * @file
 * <pre> CPE 357 Spring 2011
 * -------------------
 *
 *  Program "describe the program here (without quotes)"
 *
 *  Last Modified: Wed Oct 29 13:39:06 PM PDT 2008</pre>
 *  @author Matthew Tondreau
 */

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "server.h"
#include "debug.h"
#include <setjmp.h>
#include <map>
#include <vector>
#include <string>
#include <pthread.h>
#include <string.h>

using namespace std;
/** Main entry.
 * @param argc the number of tokens on the input line.
 * @param argv an array of tokens.
 * @return 0 on success, 1-255 on failure
 */
int
main(int argc, char *argv[])
{ 
     int sk;
   vector<pthread_t> threads;
   data_t data;
   memset( data.uidsk, 0, MAX_CONNECTIONS);
   data.vSock = vector<int>();

   sk = setup_server();

   while( tcp_listen( sk, data, threads) != ERROR ) {
      if( doexit ) {
         break;
      }
   }

   close( sk );
   fprintf(stderr, "Server Shuting Down...\n");
}

